<% if clipboard.empty? -%>
  <p class="clipboard_empty">
    <%= image_tag('information.png', :alt => 'Notice', :class => 'clipboard_info_image') %>
    <%= render 'clipboard/clipboard_empty' %>
  </p>
<% else -%>
  <table id="clipboard_table">
    <tr>
      <th></th>
      <th><%= t :name %></th>
      <th></th>
    </tr>
  <% reset_cycle -%>
  <% clipboard.folders.each do |item| -%>
    <tr class="<%= cycle('even','odd') %>">
      <td><%= image_tag('folder.png') %></td>
      <td class="clipboard_item"><%= item.name %></td>
      <td>
      <% if current_user.can_create(@folder) -%>
        <%= link_to image_tag('copy.png', :alt => t(:copy)),
          { :controller => :clipboard, :action => :copy, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :post, :title => t(:copy_folder)
        %>&nbsp;
      <% end -%>
      <% if current_user.can_create(@folder) && current_user.can_delete(item) -%>
        <%= link_to image_tag('move.png', :alt => t(:move)),
          { :controller => :clipboard, :action => :move, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :post, :title => t(:move_folder), :data => { :confirm => t(:are_you_sure) }
        %>&nbsp;
      <% end -%>
        <%= link_to image_tag('delete.png', :alt => t(:delete_item)),
          { :controller => :clipboard, :action => :destroy, :id => item.id, :type => 'folder', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :delete, :title => t(:remove_from_clipboard)
        %>
      </td>
    </tr>
  <% end -%>
  <% clipboard.files.each do |item| -%>
    <tr class="<%= cycle('even', 'odd') %>">
      <td><%= image_tag(file_icon(item.extension)) %></td>
      <td class="clipboard_item"><%= item.attachment_file_name %></td>
      <td>
      <% if current_user.can_create(@folder) -%>
        <%= link_to image_tag('copy.png', :alt => t(:copy)),
          { :controller => :clipboard, :action => :copy, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :post, :title => t(:copy_file)
        %>&nbsp;
      <% end -%>
      <% if current_user.can_create(@folder) && current_user.can_delete(item.folder) -%>
        <%= link_to image_tag('move.png', :alt => t(:move)),
          { :controller => :clipboard, :action => :move, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :post, :title => t(:move_file), :data => { :confirm => t(:are_you_sure) }
        %>&nbsp;
      <% end -%>
        <%= link_to image_tag('delete.png', :alt => t(:delete_item)),
          { :controller => :clipboard, :action => :destroy, :id => item.id, :type => 'file', :folder_id => @folder, :authenticity_token => form_authenticity_token },
          :method => :delete, :title => t(:remove_from_clipboard)
        %>
      </td>
    </tr>
  <% end -%>
  </table>
  <p>
    <%= button_to t(:clear_clipboard),
      { :controller => :clipboard, :action => :reset, :folder_id => @folder, :authenticity_token => form_authenticity_token }, :method => :put
    %>
    &nbsp; &mdash; &nbsp;
    <%= link_to t(:back), '#', :class => 'back_link' %>
  </p>
<% end -%>
